<%--
  Created by IntelliJ IDEA.
  User: srq
  Date: 2021/5/14
  Time: 13:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>数据填充</title>
    <script type="text/javascript" src="js/jquery-1.11.1.js"></script>
    <script type="text/javascript">
        $(function (){
            $("#uname").blur(function (){
                //获取姓名的value
                var uname = $(this).val();
                //发送请求
                $.post("/getuser","username="+uname,function (result){
                    //转换成可处理的js
                    result = eval("("+result+")");
                    //此时的rs是json格式的对象
                    $("#uid").val(result.id);
                    $("#sex").val(result.sex);
                    $("#usage").val(result.age);
                    $("#profession").val(result.profession);
                    $("#salary").val(result.salary);

                });

            });

        })


    </script>
</head>
<body>
<h1>信息展示</h1>
<label for="uname">姓名：</label><input type="text" id="uname"><br>
<label for="uid">学号：</label><input type="text" id="uid"><br>
<label for="sex">性别：</label><input type="text" id="sex"><br>
<label for="usage">年龄：</label><input type="text" id="usage"><br>
<label for="profession">职业：</label><input type="text" id="profession"><br>
<label for="salary">工资：</label><input type="text" id="salary"><br>


</body>
</html>
